package com.qf.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.qf.entity.Order;
import com.qf.mapper.OrderMapper;
import com.qf.service.IOrderService;
import org.springframework.stereotype.Service;

@Service
@DS("order-1")
public class OrderServiceImpl extends ServiceImpl<OrderMapper,Order> implements IOrderService {

    public void add1(Order order){
        baseMapper.insert(order);
    }

    @Override
//    @DS("order-2")
    public void add2(Order order) {

        // 计算

        String dbName = null;

        DynamicDataSourceContextHolder.push("xxxxxx");
        baseMapper.insert(order);
    }
}
